﻿using CNI.Repository.Logger;
using Microsoft.WindowsAzure;
using Microsoft.WindowsAzure.ServiceRuntime;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace CNI.Repository.Factory
{
    public class LoggerIngestFactory : IIngestRepositoryFactory
    {
        public Repostitory.Interface.IIngestRepository<T> CreateIngestRepository<T>()
        {
            var loggerFilePath = CloudConfigurationManager.GetSetting("IngestLoggerFilePath");
            var instanceId = RoleEnvironment.CurrentRoleInstance.Id;
            instanceId = instanceId.Split('.').Last();
            return new LoggerIngestion<T>(loggerFilePath, instanceId);
        }
    }
}
